package metu.tespit.session.course;

import java.util.Arrays;

import metu.tespit.entity.course.Course;
import metu.tespit.entity.semester.Semester;
import metu.tespit.session.sessionScopeManager.SessionScopeBean;

import org.jboss.seam.ScopeType;
import org.jboss.seam.annotations.In;
import org.jboss.seam.annotations.Name;
import org.jboss.seam.framework.EntityQuery;


/**
 
 * @created 22 Nis 2012
 */
@Name("courseList")
public class CourseList extends EntityQuery<Course>{

	private static final String[] RESTRICTIONS = {
		"course.semester = #{courseList.sessionScopeBean.activeSemester}",
		};
	
	public CourseList()
	{
		setEjbql("select course from Course course");
		setRestrictionExpressionStrings(Arrays.asList(RESTRICTIONS));
	}
	
	@In(scope=ScopeType.SESSION)
	private SessionScopeBean sessionScopeBean;

	public SessionScopeBean getSessionScopeBean() {
		return sessionScopeBean;
	}
	

	
}
